package com.douqu.game.main.service;

import com.douqu.game.core.database.model.DiamondsChangeModel;
import com.douqu.game.main.database.mapper.read.ReadDiamondsChangeMapper;
import com.douqu.game.main.database.mapper.write.WriteDiamondsChangeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author: miracle.
 * Description:
 * Date: 2018/5/23 0023 下午 12:11
 * Huan Yu Copyright (c) 2017 All Rights Reserved.
 */
@Service
public class DiamondsChangeServiceImpl implements DiamondsChangeService {

    @Autowired
    private ReadDiamondsChangeMapper readDiamondsChangeMapper;

    @Autowired
    private WriteDiamondsChangeMapper writeDiamondsChangeMapper;

    @Override
    public int insert(DiamondsChangeModel diamondsChange) {
        return writeDiamondsChangeMapper.insert(diamondsChange);
    }

    @Override
    public Integer getCountByTime(String playerIndex, Long minTime, Long maxTime) {
        Integer result = readDiamondsChangeMapper.getCountByTime(playerIndex,minTime,maxTime);
        return result == null? 0:result;
    }
}
